package com.lz.old.annotation;

import java.lang.annotation.Annotation;

public class Test {
	public static void main(String[] args) {
		// 此处要用反射将字段中的注解解析出来  
        //Class<ReflectAnnotation> clz = ReflectAnnotation.class;  
        // 判断类上是否有次注解  
        //boolean clzHasAnno = clz.isAnnotationPresent(FieldTypeAnnotation.class);  
		Class<?> clazz=A.class;
		
		boolean annotationPresent = clazz.isAnnotationPresent(MyAim.class);
		
		if(annotationPresent) {
			  // 获取类上的注解  
           // FieldTypeAnnotation annotation = clz.getAnnotation(FieldTypeAnnotation.class);  
			Annotation[] annotations = clazz.getAnnotations();
			for (Annotation annotation : annotations) {
				
				System.out.println(annotation.toString()+"");
			}
		}
		
	}
}
@MyAim(author="lz",desc="haha",age=25)
class A {
	@MyAim(author="field",desc="lizhong")
	private String lizhong;
}
